feat(algorithms)!: unify PyTorch runtime contracts - #95
Merged
Conversation
Signed-off-by: jiangxt2 <jiangxt2@vip.qq.com>
Remove custom recovery and storage control paths, keep checkpoint lifecycle on Ray, and tighten Torch evidence, routing, and installed-distribution conformance. Signed-off-by: jiangxt2 <jiangxt2@vip.qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR replaces Tributo's divergent PyTorch algorithm integration paths with one versioned contract and one Core-owned Ray Train runtime.
TorchRecipecovers Core-owned training loops,RayTorchAdaptercovers framework-owned worker loops, and both execute throughDistributionStrategy.RAY_TRAIN_TORCHand runtime IDtributo.ray_train_torchundertorch_runtime_api_version=1.The previous
TorchTrainingRecipeandTrainingRecipeV2surfaces both reached the same training implementation, while complex PyTorch algorithms bypassed that path by constructing their ownTorchTrainer. The new boundary makesTorchPolicy.execution_planthe single source of truth and assigns Trainer construction, role routing, collective alignment, checkpoint transport, execution evidence, and Bundle publication to Core; algorithm Wheels retain model, loss, metric, framework-adaptation, and artifact-signature responsibilities.Key changes:
TorchPolicy, single-stage and component-stage execution plans, role-routed datasets, typed runtime and stage contexts, and publicTorchRecipeandRayTorchAdapterSPIs.tributo.ray_train_torchruntime with Torch-only preflight, Core-ownedTorchTrainerorchestration, exact split and bounded replication routing, and explicit final-stage selection.ray-torch-recipe-v1withray-torch-v1, split Recipe reconstruction from Adapter export-source handling, and route both through the existingBundleExportService.This is intentionally one atomic implementation change because the public Policy, SPI, Runtime, Checkpoint, Evidence, and Source Provider identities must move together; merging an intermediate subset would leave installed PyTorch descriptors without a valid execution or export path.
Related issues
Additional information
Cross-repository coordination
tributo-algorithms/master.cdb247c; existing candidate Wheels predate the final Core commit and are not valid evidence for this PR.Breaking changes and migration
TorchTrainingRecipe,TrainingRecipeV2,AlgorithmBuilder.from_torch_recipe(), andAlgorithmBuilder.from_training_recipe_v2().ray-torch-recipe-v1source-provider identity.TorchRecipe,RayTorchAdapter,AlgorithmBuilder.from_torch(),AlgorithmBuilder.from_torch_adapter(),RAY_TRAIN_TORCH,tributo.ray_train_torch, andray-torch-v1.TorchPolicy, the execution plan, role routing, metric reducers, state layout, and the independent Torch Runtime API version.dnn.recipe_v2,pu.recipe_v2,lstm_classifier.recipe_v2, andgru_classifier.recipe_v2to their algorithm identities and remove the.recipe_v2suffix from the LSTM and GRU implementation IDs.The companion
tributo-algorithmsmigration must be released in coordination with this Core change. Existing PyTorch Wheels implementing the removed interfaces are not compatible with the new runtime.Compatibility boundary
Local static and changed-test validation is complete; Docker Ray IT, companion Wheel conformance, and external cluster gates remain pending before merge.
Validation completed for commit cdb247c
uv run --locked --no-sync python scripts/pr-precheck.py— format, dependency, CI-policy, API-stability, suppression, commit, hygiene, changed-test, and CI-parity layers passed; the run identified one documentation spelling issue, which was fixed without changing runtime or test code.uv run --locked --no-sync python scripts/pr-precheck.py --skip-teststhen passed every non-test layer without repeating the completed changed-test run.1016 passed, 9 skipped, 113 deselected.34 passed, 2 skipped.4edcc5f—220 passed.git diff --check— passed.Pending validation before merge
distributed-algorithm-clustermanual gate on exact Core revisioncdb247cand algorithm revision4edcc5fto cover multi-worker Ray Jobs training, exact role routing, component Stage dependencies, Tune fit-only checkpoint behavior, Bundle publication, and Ray Data inference without skipped tests.scripts/ci_test_plan.pyfor thepyproject.toml, runtime, export, inference, and documentation changes, and record each suite as passed or explicitly not required with a concrete scope reason.Fixed-Wheel and cluster results remain pending and will not be inferred from local unit evidence.
Reviewer focus
TorchPolicy.execution_planis the only stage and routing declaration and that neither Recipe nor Adapter can create a nested Trainer or provide a competing execution plan.final_stage_idcan supply the exported Bundle.ray-torch-v1Recipe and Adapter export branches, Artifact Plan binding, required-artifact failure behavior, andcomposition_digestpropagation.Non-goals